/*
 * Giffel, Android application
 *
 * Copyright (C) 2011  Mid Sweden University
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package se.appening;

import android.location.Location;

public class Entry {

    public static int SERVERPORT = 2665;
    public static String SERVERADDRESS = "193.10.119.33";
    
    public String id;
    
    public String title = "";
    public String type = "";
    public String description = "";
    
    public Location location;
    public float distance;
    
    public String imageUrl = "";

    public Entry() {
    }

    public Entry(String title, String type, String distance, String imageUrl, String description) {
        this.title = title;
        this.type = type;
        this.imageUrl = imageUrl;
        this.distance = Float.parseFloat(distance);
        this.description = description;
    }

    String getTitle() {
        return title;
    }

    String getType() {
        return type;
    }

    String getDescription() {
        return description;
    }

    float getDistance() {
        float f = (int) distance;
        return f;
    }

    String getImageUrl() {
        return imageUrl;
    }

    int getVotes() {
        return new ServerConnector(SERVERADDRESS, SERVERPORT).getVotes(id);
    }

    public boolean vote() {
        return new ServerConnector(SERVERADDRESS, SERVERPORT).addVote(id);
    }

}
